<layout-header></layout-header>

<nav class="container-xl mb-3">
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a routerLink="/welcome">首页</a></li>
        <li class="breadcrumb-item active">群聊配置</li>
    </ol>
</nav>

<div class="container-xl mb-3">
    <div class="text-end mb-3">
        <button class="btn btn-primary" [routerLink]="['/chatroom/create']">添加</button>
    </div>

    <table class="table table-hover align-middle">
        <thead class="table-light">
            <tr>
                <th scope="col">#</th>
                <th scope="col">群名</th>
                <th scope="col" class="d-none d-lg-table-cell">别名</th>
                <th scope="col" class="d-none d-sm-table-cell">级别</th>
                <th scope="col" class="d-none d-md-table-cell">加群指令</th>
                <th scope="col" class="d-none d-xl-table-cell">回应拍拍</th>
                <th scope="col" class="d-none d-xxl-table-cell">撤回提示</th>
                <th scope="col" class="d-none d-xl-table-cell">默认模型</th>
                <th scope="col">操作</th>
            </tr>
        </thead>
        <tbody>
            @for (item of chatrooms; track item.rd) {
            <tr>
                <th scope="row">{{item.rd}}</th>
                <td>{{wcfChatrooms[item.roomid] && wcfChatrooms[item.roomid].name || item.roomid}}</td>
                <td class="d-none d-lg-table-cell">{{item.name}}</td>
                <td class="d-none d-sm-table-cell">{{roomLevels[item.level] && roomLevels[item.level].name || '-'}}</td>
                <td class="d-none d-md-table-cell">{{item.join_argot}}</td>
                <td class="d-none d-xl-table-cell">{{item.pat_return && item.pat_return == 'true' ? '是' : '否'}}</td>
                <td class="d-none d-xxl-table-cell w-max150 text-truncate">{{item.revoke_msg}}</td>
                <td class="d-none d-xl-table-cell">{{item.model_default}}</td>
                <td class="text-nowrap">
                    <button class="btn btn-sm btn-primary me-2" routerLink="/chatroom/update/{{item.rd}}">编辑</button>
                    <button class="btn btn-sm btn-danger me-2" (click)="deleteChatroom(item)">删除</button>
                </td>
            </tr>
            }
        </tbody>
    </table>
</div>